const { DataTypes } = require('sequelize')

const seq = require('../db/seq.js')


//创建用户模型 KOA_USER(用户表)

const User = seq.define('User', {
    user_id: {
        type: DataTypes.UUID,
        defaultValue: DataTypes.UUIDV4,
        primaryKey: true,
        comment: "用户id",
    },
    user_password: {
        type: DataTypes.CHAR(64),
        allowNull: false,
        comment: "用户密码"
    },
    user_nickname: {
        type: DataTypes.STRING,
        unique: true,
        allowNull: false,
        comment: '用户昵称 唯一'
    },
    user_email: {
        type: DataTypes.STRING,
        allowNull: false,
        unique: true,
        comment: "用户邮箱"
    },
    image: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '用户头像'
    },
    imagekey: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: "用户头像唯一key"
    }

})


//如果有则删除数据库
// User.sync({ force: true })

module.exports = User